﻿
package org.aquiferserver.common
{
	
	/**
	 * ...
	 * @author Seth Albanese
	 * @version $Id: Player.as 60 2009-06-15 08:47:09Z salbanese0080@gmail.com $
	 */
	[RemoteClass(alias="org.aquiferserver.common.Player")]
	public class Player 
	{
		
		private var _id:int = 0;
		private var _props:Object = new Array();
		
		public function Player() 
		{
			
		}
		
		public function get id() : int { return _id; }
		public function set id( i:int  ) : void { _id = i };
		
		public function get properties() : Array { return _props; }
		public function set properties( p:Array ) : void { _props = p; }
		
		public function addProperty( key:String, val:String ) : void 
		{
			_props[ key ] = val;
		}
		
		public function fetchProperty( key:String ) : String 
		{
			return _props[ key ];
		}
		
		public function toJSON() : String 
		{
			var json:String = "{id:" + _id;
			
			for ( var k:String in _props )
			{
				json += "," + k + ":\"" + _props[ k ] + "\"";
			}
			
			json += "}";
			
			return json;
			
		}
		
	}
	
}